package cn.elegent.txdemo.product.controller;

import cn.elegent.txdemo.common.dto.PayDto;
import cn.elegent.txdemo.product.feign.OrderFeign;
import cn.elegent.txdemo.product.feign.UserFeign;
import cn.elegent.txdemo.product.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 发起购买的controller (入口)
 */
@RestController
@RequestMapping("/product")
public class PayController {


    @Autowired
    private ProductService productService;

    /**
     * 购买
     */
    @GetMapping("/pay")
    public void pay(){
        PayDto payDto = new PayDto();
        payDto.setProductId(1); //商品id
        payDto.setNum(3);// 数量
        payDto.setUserId(2);//用户id
        productService.pay(payDto);// 下单
    }

}
